package main

import (
	"os"
	"os/signal"
	"region/config"
	"region/core"
	_ "region/game"
	l "util/log"
)

func main() {

	c := config.CreateConfig()
	if !c.Load() {
		l.LogError("load config failed")
		return
	}

	ch := make(chan bool)

	r := core.GetRegionMgr()
	go r.Start(ch, c)

	s := make(chan os.Signal, 1)
	signal.Notify(s, os.Interrupt)
	go func() {
		select {
		case <-s:
			core.ServiceQuit()
			l.TraceInfo("region", "stop service")
		}
	}()
	<-ch

}
